home *** CD-ROM | disk | FTP | other *** search
- /* File: main.c */
-
- #define __Main__
- #include "AESimple.h"
-
- void DoKey (EventRecord *theEvent)
- {
- char keyPressed = (theEvent->message & charCodeMask);
-
- if (theEvent->modifiers & cmdKey) {
- AdjustMenus();
- Dispatch(MenuKey(keyPressed)); /*Command key down*/
- }
- } /* DoKey */
-
-
-
-
- void DoMouseDown (EventRecord *theEvent)
- {
- Point globalPt = theEvent->where;
- short windowPart;
- WindowPtr whichWindow;
- Rect dragRect;
-
- windowPart = FindWindow(globalPt, &whichWindow);
- switch (windowPart) {
- case inMenuBar:
- AdjustMenus();
- Dispatch(MenuSelect(globalPt));
- break;
-
- case inSysWindow:
- SystemClick(theEvent, whichWindow);
- break;
-
-
- case inGoAway:
- if (TrackGoAway(whichWindow, theEvent->where))
- CloseAWindow(whichWindow);
- break;
-
- case inDrag:
- dragRect = screenBits.bounds;
- dragRect.top = 40;
- DragWindow(whichWindow, theEvent->where, &dragRect);
- break;
-
- case inGrow:
- DoGrowWindow(whichWindow, theEvent);
-
- case inContent:
- DoContentClick(whichWindow, globalPt);
- break;
-
- case inZoomIn:
- case inZoomOut:
- if (TrackBox(whichWindow, globalPt, windowPart)) {
- SetPort(whichWindow);
- ZoomWindow(whichWindow, windowPart, TRUE);
- } break;
- }
- } /* DoMouseDown */
-
-
- void MainLoop()
- {
- EventRecord theEvent;
- DialogPtr whichDialog;
- short itemHit;
-
- while (!gDone) {
- WaitNextEvent(everyEvent, &theEvent, 120L, NIL);
- switch (theEvent.what) {
- case nullEvent:
- InitCursor();
- break;
-
- case mouseDown:
- DoMouseDown(&theEvent);
- break;
-
- case keyDown:
- case autoKey:
- DoKey(&theEvent);
- break;
-
- case activateEvt:
- DoActivate(&theEvent);
- break;
-
- case updateEvt:
- DoUpdate((WindowPtr)theEvent.message);
- break;
-
- case app4Evt:
- break;
-
- case kHighLevelEvent:
- (void)AEProcessAppleEvent(&theEvent);
- }
- }
- } /* MainEventLoop */
-
-
- void main()
- {
- MaxApplZone();
- MoreMasters(); /* create more master pointers */
- MoreMasters(); /* create more master pointers */
- MoreMasters(); /* create more master pointers */
- MoreMasters(); /* create more master pointers */
-
- Init_all(); /* call initialization routine */
- UnloadSeg((ProcPtr)Init_all); /* make segment purgable */
- AdjustMenus();
- MainLoop();
- }